package mysqlinit

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsTitle  string  `gorm:"type:varchar(50);not null;commit:标题"`
	GoodsPrice  float64 `gorm:"type:decimal(10,2);not null;commit:价格"`
	GoodsStock  int     `gorm:"type:int(11);not null;commit:库存"`
	GoodsStatus int     `gorm:"type:tinyint(1);not null;commit: 0 下架 1 上架"`
}

func (g *Goods) CreateGoods() error {
	return DB.Debug().Create(&g).Error
}
func (g *Goods) FindGoods(goodsId int) error {
	return DB.Debug().Where("id = ?", goodsId).Find(&g).Error
}

type User struct {
	gorm.Model

	Account string `gorm:"type:varchar(18);not null;commit:用户"`
}
